/**
 * Created by Mark_ren on 2017/5/23.
 * 今天心情不好，可能是因为阴天。
 */
var co = require('co');
var seqModule = require('../../../routes/createModules');
var seq = new seqModule();
var util = require('../../../common/util');

var searchLogController = {

    /**
     *  增加搜索记录
     * @param req
     * @param res
     */
    addSearchLog: function (req, res) {
        co(function () {
            var uuid = util.getUUID();
            req.query.id = uuid;
            req.query.createTime = util.getNowTime();
            req.query.content = decodeURI(req.query.content);
            seq.serachLogModule.create(req.query).then(function (result) {
                res.json({
                    success: true,
                    message: "添加成功",
                    result: result
                });
            })
        }).catch(function (e) {
            res.json({ 'success': false, 'msg': '新增失败' });
            console.log(e);
        })

    }
}
module.exports = searchLogController;